export interface responseData {
  code: number;
  message: string;
  ok: boolean;
}

export interface SpuData {
  id?: number;
  spuName: string;
  description: string;
  category3Id: number | string;
  tmId: number | string;
  spuSaleAttrList: SpuImg[];
  spuImageList: SaleAttr[];
}

export type Records = SpuData[];

export interface HasSpuResponseData extends responseData {
  data: {
    records: Records;
    total: number;
    size: number;
    current: number;
    searchCount: boolean;
    pages: number;
  };
}

//品牌数据的T类型
export interface TradeMark {
  id: number;
  tmName: string;
  logoUrl: string;
}

//品牌接口返回的数据ts类型
export interface AllTradeMark extends responseData {
  data: TradeMark[];
}

//商品图片的ts类型
export interface SpuImg {
  id?: number;
  createTime?: string;
  updateTime?: string;
  spuId?: number;
  imgName?: string;
  imgUrl?: string;
  name?: string;
  url?: string;
}

//SPU图片墙数据的类型
export interface SpuHasImg extends responseData {
  data: SpuImg[];
}

//销售属性值
export interface SaleAttrValue {
  id?: number;
  createTime?: string;
  updateTime?: string;
  spuId?: number;
  baseSaleAttrId: number | string;
  saleAttrValueName: string;
  saleAttrName?: string;
  isChecked?: null;
}

//销售属性值数组
export type spuSaleAttrValueList = SaleAttrValue[];

//销售属性
export interface SaleAttr {
  id?: number;
  createTime?: string;
  updateTime?: string;
  spuId?: number;
  baseSaleAttrId: number | string;
  saleAttrName: string;
  spuSaleAttrValueList: spuSaleAttrValueList;
  flag?: boolean;
  saleAttrValue?: string;
  saleIdAndValueId?: string;
}

//销售属性接口信息
export interface SaleAttrResponseData extends responseData {
  data: SaleAttr[];
}

//已有的全部SPU的返回数据ts类型
export interface HasSaleAttr {
  id: number;
  name: string;
}

export interface HasSaleAttrResponseData extends responseData {
  data: HasSaleAttr[];
}

// 添加SKU参数ts类型
export type Attr = {
  attrId: number | string;
  valueId: number | string;
};

export type SaleAttrForSkuData = {
  saleAttrId: number;
  saleAttrValueId: number;
};

export interface SkuData {
  category3Id: string | number;
  spuId: string | number;
  tmId: string | number;
  skuName: string;
  price: string | number;
  weight: string | number;
  skuDesc: string;
  skuAttrValueList?: Attr[];
  skuSaleAttrValueList?: SaleAttrForSkuData[];
  skuDefaultImg: string;
}

// spu下的sku列表
export interface SkuInfoData extends responseData {
  data: SkuData[];
}
